<?php
// $Id: user-profile.tpl.php,v 1.2.2.1 2008/10/15 13:52:04 dries Exp $

/**
 * @file user-profile.tpl.php
 * Default theme implementation to present all user profile data.
 *
 * This template is used when viewing a registered member's profile page,
 * e.g., example.com/user/123. 123 being the users ID.
 *
 * By default, all user profile data is printed out with the $user_profile
 * variable. If there is a need to break it up you can use $profile instead.
 * It is keyed to the name of each category or other data attached to the
 * account. If it is a category it will contain all the profile items. By
 * default $profile['summary'] is provided which contains data on the user's
 * history. Other data can be included by modules. $profile['user_picture'] is
 * available by default showing the account picture.
 *
 * Also keep in mind that profile items and their categories can be defined by
 * site administrators. They are also available within $profile. For example,
 * if a site is configured with a category of "contact" with
 * fields for of addresses, phone numbers and other related info, then doing a
 * straight print of $profile['contact'] will output everything in the
 * category. This is useful for altering source order and adding custom
 * markup for the group.
 *
 * To check for all available data within $profile, use the code below.
 *
 * @code
 *   print '<pre>'. check_plain(print_r($profile, 1)) .'</pre>';
 * @endcode
 *
 * @see user-profile-category.tpl.php
 *   Where the html is handled for the group.
 * @see user-profile-field.tpl.php
 *   Where the html is handled for each item in the group.
 *
 * Available variables:
 *   - $user_profile: All user profile data. Ready for print.
 *   - $profile: Keyed array of profile categories and their items or other data
 *     provided by modules.
 *
 * @see template_preprocess_user_profile()
 */
?>
  <?php
$output = array();
$output['right'] = array();
$output['main'] = array();

foreach ($profile as $type => $data) {
	//echo " | ".$type;
	//user_picture simplenews locations faveliste summary 
  if ($type == 'user_picture'||$type == 'simplenews'||$type == 'locations') {
    $output['right'][] = $data;
  } else {
    $output['main'][] = $data;
  }
}
?>

<?php // OUTPUT ----------------------------- ?>

<div class='profile'>
<div class="dp50">
<?php foreach($output['main'] as $data) { echo $data; } ?>
    </div>
    <div class="dp49">
    <a href="/favorite_shops/<? print $user->uid ?>">view this users favorite shops</a>
    <?php foreach($output['right'] as $data) { echo $data; } ?>
  </div>
  <div class="clear"></div>
  <div id="added_shops">
  <h1>Shops added by <? print $user->name; ?></h1>
  <?php $nlimit = 10; ?>
<?php $userid=$user->uid; ?>
<?php $result1 = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.status = 1 AND n.uid = $userid AND n.type = 'shop' ORDER BY n.created DESC"), variable_get('default_nodes_main', $nlimit)); ?>
<?php while ($node = db_fetch_object($result1)) {$output2 .= node_view(node_load(array('nid' => $node->nid)), 1);}; ?>
<?php print $output2; ?>
</div> 
</div>


